﻿@using BootstrapBlazor.Shared.Samples;
@inject IStringLocalizer<Switchs> Localizer

<div class="row g-3">
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Switch ValueChanged="@OnValueChanged" Value="@BindValue" OnColor="Color.Secondary" OnText="@Localizer["SwitchsOnText"]" OffText="@Localizer["SwitchsOffText"]"></Switch>
    </div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Switch Value="true" OnColor="Color.Success" OnText="@Localizer["SwitchsOnText"]" OffText="@Localizer["SwitchsOffText"]"></Switch>
    </div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Switch Value="true" OnColor="Color.Danger" OnText="@Localizer["SwitchsOnText"]" OffText="@Localizer["SwitchsOffText"]"></Switch>
    </div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Switch Value="true" OnColor="Color.Warning" OnText="@Localizer["SwitchsOnText"]" OffText="@Localizer["SwitchsOffText"]"></Switch>
    </div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Switch Value="true" OnColor="Color.Info" OnText="@Localizer["SwitchsOnText"]" OffText="@Localizer["SwitchsOffText"]"></Switch>
    </div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Switch Value="true" OnColor="Color.Dark" OnText="@Localizer["SwitchsOnText"]" OffText="@Localizer["SwitchsOffText"]"></Switch>
    </div>
</div>
<ConsoleLogger @ref="Logger" class="mt-3" />

@code {
    [NotNull]
    private ConsoleLogger? Logger { get; set; }

    private bool BindValue { get; set; } = true;

    private void OnValueChanged(bool val)
    {
        BindValue = val;
        Logger.Log($"Switch CurrentValue: {val}");
    }
}
